<!DOCTYPE html >
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="icon" type="image/gif" href="slike/animated_favicon1.gif">
<script src="skripte/Cookies.js"></script>
<script src="skripte/proba1.js"></script>
<script src="jQuery/jquery-1.10.2.js"></script>
<script src="skripte/kreirajNavigaciju.js" charset="UTF-8"/></script>
<LINK href="stilovi/users.css" rel="stylesheet" type="text/css">
<LINK href="stilovi/srednjeDugme.css" rel="stylesheet" type="text/css">
<LINK href="stilovi/navigacija.css" rel="stylesheet" type="text/css">
<LINK href="stilovi/coda-slider.css" rel="stylesheet" type="text/css">
<LINK href="stilovi/templatemo_style.css" rel="stylesheet" type="text/css">
<LINK href="stilovi/login.css" rel="stylesheet" type="text/css">
<link rel="icon" type="image/gif" href="slike/animated_favicon1.gif">

<title>Korisnici</title>

</head>
<body>

<div id="slider">
 
	<div id="templatemo_main">
    	<ul id="social_box">
            <h1> Javna saobraćajna mreža Bosne i Hercegovine </h1>         
        </ul>
        
        <div id="content">
     
            <div class="scroll">
                <div class="scrollContainer">
                
                    <div class="panel" id="home">             
                        
                        <div id="navigacija"></div>
						<div id="adminDiv">
						<i>Loginovani ste kao: </i>
						</div>
						Filter: <input type="text" id="filter" onkeyup="filtriraj()">
						<!-- <button type="button" onClick="filtriraj()" >Filtriraj</button>-->
						<h4>Postojeći korisnici:</h4>
						<div id="sviKorisnici" style="clear:both">
						</div>
						<script>
						navigacija();
						if(readCookie('login')!=null){
							$('#adminDiv i').append(readCookie('login'));
							if(readCookie('login')!='gost')
							{
								$('#adminDiv').append("<a href='login.html'>Odjavite se</a>");
							}
							else
							{
								$('#adminDiv').append("<a href='login.html'>Prijavite se</a>");
							}
						}
						var req = createRequest(); // defined above
						// Create the callback:
						req.onreadystatechange = function() {
  							if (req.readyState != 4) return; // Not there yet
 							if (req.status != 200) {
    						// Handle request failure here...
    						return;
 						 }
 						 // Request successful, read the response
  						var resp = req.responseXML.getElementsByTagName("username");
 						 // ... and use it as needed by your app.
   
 						 for (var i=0;i<resp.length;i++)
	 					 {
	  					  	var korisnik=resp[i].childNodes[0].nodeValue;
						    $('#sviKorisnici').append("<div class='userDiv'><a href=role.html?korisnik="+korisnik+">"+korisnik+"</a></div>")
	  					 }
						  //$('#sviKorisnici').append(resp[1]);
						  return;
						}
						req.open("GET","korisno/users/logins", true);
						req.send();
						function filtriraj()
						{
							$('#sviKorisnici').empty();
							var req = createRequest(); // defined above
							// Create the callback:
							req.onreadystatechange = function() {
	  						if (req.readyState != 4) return; // Not there yet
						    if (req.status != 200) {
						    // Handle request failure here...
	   						 return;
	 						 }
	 					 // Request successful, read the response
	 					 var resp = req.responseXML.getElementsByTagName("username");
	 					 // ... and use it as needed by your app.
	   
	 					 for (var i=0;i<resp.length;i++)
						  {
							  var korisnik=resp[i].childNodes[0].nodeValue;
							  $('#sviKorisnici').append("<div class='userDiv'><a href=role.html?korisnik="+korisnik+">"+korisnik+"</a></div>")
						  }
						  //$('#sviKorisnici').append(resp[1]);
					  return;
					}
					req.open("GET","korisno/users/filter?filter="+$('#filter').val(), true);
					req.send();
	
					}
					</script>
						
        	        </div> 
        	            
     
			</div>
 
        
        </div> 
    </div>
    
    </div> 
</div>

</body>
</html>